//
//  AbumHeaderView.m
//  HimalayaMusic
//
//  Created by dllo on 16/1/14.
//  Copyright © 2016年 WXCLegendary. All rights reserved.
//

#import "AbumHeaderView.h"

@implementation AbumHeaderView

-(instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backImage = [[UIImageView alloc] init];
        self.imageViews = [[UIImageView alloc] init];
        self.titleLabel = [[UILabel alloc] init];
        self.introLabel = [[UILabel alloc] init];
        
        [self addSubview:self.backImage];
        [self addSubview:self.imageViews];
        [self addSubview:self.titleLabel];
        [self addSubview:self.introLabel];
    }
    return self;
}

-(void)layoutSubviews {
    [super layoutSubviews];
    self.backImage.frame = self.bounds;
    self.imageViews.frame = CGRectMake(self.width / 2 - 30, 30, 60, 60);
    
    self.titleLabel.frame = CGRectMake(80, self.imageViews.origin.y + self.imageViews.height + 20, self.width - 160, 20);
    self.introLabel.frame = CGRectMake(self.titleLabel.left, self.titleLabel.bottom + 10, self.titleLabel.width, self.height - self.titleLabel.bottom - 20);
}


- (void)setModel:(AnchorModel *)model {
    if (_model != model) {
        _model = model;
    }
    [self.backImage sd_setImageWithURL:[NSURL URLWithString:self.model.backgroundLogo]];
    
    //    NSLog(@"%@", self.model.backgroundLogo);
    
    [self.imageViews sd_setImageWithURL:[NSURL URLWithString:self.model.middleLogo]];
    self.imageViews.layer.masksToBounds = YES;
    self.imageViews.layer.cornerRadius = 30;
    self.titleLabel.text = self.model.nickname;
    self.titleLabel.font = [UIFont systemFontOfSize:13];
    self.titleLabel.textColor = [UIColor whiteColor];
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.introLabel.text = self.model.personalSignature;
    self.introLabel.textAlignment = NSTextAlignmentCenter;
    self.introLabel.font = [UIFont systemFontOfSize:11];
    self.introLabel.numberOfLines = 0;
    self.introLabel.textColor = [UIColor whiteColor];
}


@end
